import Vue from 'vue';
import App from './App.vue';

import VueResoure from 'vue-resource';
Vue.use(VueResoure);

/*路由跳转配置 0、路由插件导入和使用 */
import VueRouter from 'vue-router';
Vue.use(VueRouter);

/*路由跳转配置 1、创建路由所需组件并在此引入组件 */
import Header from './components/header.vue';
import Footer from './components/footer.vue';
import Menu from './components/menu.vue';
import Content from './components/content.vue';
import GetContent from './components/getContent.vue';
import NewsContent from './components/newsContent.vue';

/*路由跳转配置 2、定义路由 */
const routes = [
  { path: '/header', component: Header },
  { path: '/footer', component: Footer },
  { path: '/menu', component: Menu },
  { path: '/getContent', component: GetContent },
  { path: '/content/:aid', component: Content },
  { path: '/newsContent/:aid', component: NewsContent },
  { path: '*', redirect: '/header' }   /*默认跳转路由*/
]
/*路由跳转配置 3、实例化VueRouter */
const router = new VueRouter({
  // （缩写）相当于 routes: routes
  routes 
})

new Vue({
  el: '#app',
  router,/*路由跳转配置 4、添加路由项 */
  render: h => h(App)
})
